<!doctype html>
<?php
include '../base.php';

import('config,arr,db');

$dbConfig = Config::get('database.default');
Db::instance($dbConfig);

$res = Db::query("select * from db_foolcars.cms_coclass where coid = 1");
while($row = $res->fetch_assoc()){
	$maps[$row['pid']][] = $row['ccid'];
	$data[$row['ccid']] = $row;
}

foreach($maps[0] as $manid){
	$table[] = $manid;
	if(isset($maps[$manid])) : foreach($maps[$manid] as $subid){
		$table[] = $subid;
		if(isset($maps[$subid])): foreach($maps[$subid] as $lowid){
			$table[] = $lowid;
		} endif;
	} endif;
}

?>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<title>wind management</title>
<link href="http://i.autocar.com/res/css/admin_style.css?v=1.0.0" rel="stylesheet" />
</script>
<script src="/statics/js/jquery.js"></script>
<script src="/statics/js/supe.js"></script>
</head>

<body>
<div class="wrap">
<!--
  <div class="nav">
    <ul class="cc">
      <li class="current"><a href="http://i.autocar.com/admin.php?m=bbs&amp;c=setforum">版块管理</a></li>
      <li><a href="http://i.autocar.com/admin.php?m=bbs&amp;c=setforum&amp;a=editgroup">编辑分类</a></li>
      <li><a href="http://i.autocar.com/admin.php?m=bbs&amp;c=setforum&amp;a=baseinfo">基本信息</a></li>
      <li><a href="http://i.autocar.com/admin.php?m=bbs&amp;c=setforum&amp;a=extinfo">功能设置</a></li>
      <li><a href="http://i.autocar.com/admin.php?m=bbs&amp;c=setforum&amp;a=classif">主题分类</a></li>
      <li><a href="http://i.autocar.com/admin.php?m=bbs&amp;c=setforum&amp;a=permissions">权限相关</a></li>
      <li><a href="http://i.autocar.com/admin.php?m=bbs&amp;c=setforum&amp;a=credits">积分相关</a></li>
    </ul>
  </div>
-->
  <div class="h_a">搜索</div>
  <div class="table_full">
    <form id="J_forum_search_form" method="post" action="http://i.autocar.com/admin.php?m=bbs&amp;c=setforum&amp;a=searchforum">
      <table width="100%">
        <tr>
          <td><div class="fl">
              <div id="J_search_suggestion" class="forum_search_pop" style="display:none;margin-top:25px;"></div>
            </div>
            <input id="J_search_input" class="input length_3 mr10" name="keyword" autoComplete="off" type="text">
            <button id="J_forum_search" class="btn btn_submit" type="submit">搜索</button></td>
        </tr>
      </table>
      <input type='hidden' name='csrf_token' value='c3cdb92cb69ff2ea'/>
    </form>
  </div>
  <form class="J_ajaxForm" data-role="list" action="http://i.autocar.com/admin.php?m=bbs&amp;c=setforum&amp;a=dorun" method="post">
    <div class="mb10"> <a href="#" id="J_start_all" class="mr5">全部展开</a><span class="mr5 gray">|</span><a id="J_away_all" href="#">全部收起</a> </div>
    <div class="table_list">
      <table width="100%" id="J_table_list" style="table-layout:fixed;">
        <colgroup>
        <col width="20">
        <col width="400">
        <col width="60">
        <col width="210">
        <col>
        </colgroup>
        <thead>
          <tr>
            <td></td>
            <td><span class="mr5">[顺序]</span>版块名称（双击版块名称可编辑版块标题）</td>
            <td class="tar">fid</td>
            <td>版主</td>
            <td>操作</td>
          </tr>
        </thead>
        <?php
			foreach($table as $ccid){
				$row   = $data[$ccid];
				$trid  = 'node-'.$row['ccid'];
				$class = ($row['pid']) ? 'sub-node-'.$row['pid'] : '';
		?>
          <tr id="<?=$trid;?>" class="<?=$class;?>">
            <td></td>
            <td>
              <span class="mr10 J_forum_names" data-id="1"><?=$row['title'];?></span></td>
            <td class="tar"><?=$row['ccid'];?></td>
            <td><input type="text" class="input mr5" name="vieworder[1]" value="0" style="width:20px;"></td>
            <td><a href="#" target="_blank" class="mr5">[访问]</a><a href="#" class="mr5">[编辑]</a><a href="#" class="mr5 J_ajax_del">[删除]</a></td>
          </tr>
        <?	
			}
        ?>
        
      </table>
      <table width="100%">
        <tr>
          <td colspan="5" style="padding-left:38px;"><a id="J_add_root" data-type="forum_root" data-html="tbody" href="#" class="link_add">添加新分类</a></td>
        </tr>
      </table>
    </div>
    <div class="btn_wrap">
      <div class="btn_wrap_pd">
        <button type="submit" class="btn btn_submit J_ajax_submit_btn">提交</button>
      </div>
    </div>
    <input type='hidden' name='csrf_token' value='c3cdb92cb69ff2ea'/>
  </form>
  
  
  
  
</div>
<script>
Supe.use('treeTable', function(){
	$('#J_table_list').treeTable();
});
</script>
</body>
</html>
